<template>
	<div>
		<el-transfer
			v-model="values"
			:data="datas"
			:titles="['未选中', '已选中']"
			:props="{
				label: 'nursingName',
				key: 'id'
			}"></el-transfer>
		<el-button type="primary" @click="save">保存</el-button>
	</div>
</template>

<script setup>
import { get, post } from '@/axios'
import { ref } from 'vue'
const props = defineProps(['levelId'])
const emits = defineEmits(['update:show'])
const values = ref(await getValues())
const datas = ref(await getItmes())
function getValues () {
	return new Promise(resolve => {
		get('/nurselevelitem/list', { levelId: props.levelId }, content => {
			resolve(content)
		})
	})
}
function getItmes () {
	return new Promise(resolve => {
		get('/nursecontent/getList', {}, content => {
			resolve(content)
		})
	})
}
function save () {
	post('/nurselevelitem/add', { levelId: props.levelId, itemIds: values.value }, content => {
		emits('update:show', false)
	})
}
</script>

<style scoped lang="scss">
.el-button {
	margin-top: 20px;
}
</style>